package info.openlvb.openface.client.base.person;

import com.google.gwt.event.logical.shared.OpenEvent;
import com.google.gwt.event.logical.shared.OpenHandler;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class GroupFunctionsPanel extends VerticalPanel{

	DisclosurePanel addGroup,listGroup;
	ListGroupPanel listGroupPanel;
	
	public GroupFunctionsPanel(){
		setWidth("90%");
		addGroup = new DisclosurePanel("Ajouter un groupe");
		addGroup.setAnimationEnabled(true);
		addGroup.setContent(new AddGroupPanel());
		listGroup = new DisclosurePanel("Lister les groupes");
		listGroup.setAnimationEnabled(true);
		listGroupPanel = new ListGroupPanel();
		listGroup.setContent(listGroupPanel);
		listGroup.setOpen(false);
		addGroup.setOpen(false);
		addGroup.addOpenHandler(new OpenHandler<DisclosurePanel>() {
			public void onOpen(OpenEvent<DisclosurePanel> event) {
				listGroup.setOpen(false);
			}
		});
		listGroup.addOpenHandler(new OpenHandler<DisclosurePanel>() {
			public void onOpen(OpenEvent<DisclosurePanel> event) {
				addGroup.setOpen(false);
				listGroupPanel.refresh();
			}
		});
		add(addGroup);
		add(listGroup);
	}
}
